# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2022/9/1
# @Author  : moe@miku39.fun
# @File    : Toml.py
# @Software: PyCharm
import tomli
import tomli_w


class TomlOperation:
    def __init__(self, file):
        self.file = file

    def readToml(self) -> dict:
        return tomli.load(open(self.file, "rb"))

    def updateToml(self, data):
        tomli_w.dump(data, open(self.file, "wb"))
